﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.burry.services.SizeService" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ taglib prefix="s" uri="/struts-tags"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Bary</title>
<!--Script and CSS includes for YUI dependencies on this page-->

<link rel="stylesheet" type="text/css" id="css" href="Resource/css/main.css">
<link rel="stylesheet" type="text/css" id="css" href="Resource/css/css.css">
<link rel="stylesheet" type="text/css" id="css" href="Resource/css/good.css">
<script language="JavaScript" src="Resource/js/core.js"></script>
<script src='Resource/js/upload.js'> </script>
<script src='../dwr/interface/UploadMonitor.js'> </script>
<script src='../dwr/engine.js'> </script>
<script src='../dwr/util.js'> </script>
		<style type="text/css">
            body { font: 11px Lucida Grande, Verdana, Arial, Helvetica, sans serif; }
            #progressBar { padding-top: 5px; }
            #progressBarBox { width: 350px; height: 20px; border: 1px inset; background: #eee;}
            #progressBarBoxContent { width: 0; height: 20px; border-right: 1px solid #444; background: #9ACB34; }
    </style>
</head>
<body>

  <div id="framed">
    <h2>新增套图</h2>
  </div>
  <div>
  	<%
  	
  int size = 0;
	String goodId = (String)request.getParameter("good_id");
	if(goodId == null)
		goodId = (String)request.getParameter("gid");
	String colorId = (String)request.getParameter("colorId");
	if(colorId == null)
		colorId = (String)request.getParameter("cid");
	
	String colorName = (String)request.getParameter("cname");
	//out.print(colorName);
if(null == colorId)
	colorId = "";
if(null == colorName)
	colorName = "";
	List fileList = (List)request.getAttribute("fileNameMap");
	if(fileList != null)
	
		size = fileList.size();
%>
<form action="savePicInfo.do" id="savePicInfo" method="post">
	
	 <input type="hidden" id="goodId" name="goodId" value="<%=goodId%>"/>   
	 <input type="hidden" id="colorId" name="colorId" value="<%=colorId%>"/> 
          <div class="line_pubForm">
            <table width="100%" style="tabSty">

              <tr>
                <td width=120 align=right>套图名称：</td>
                <td align=left><input type="text" id="colorName" name="colorName" class="iptSty" value="<%=colorName%>">
                  &nbsp;&nbsp; 
              </tr>
            </table>
            <% if(fileList != null && size>=1){ %> 
				<input type="hidden" name="prdColor" value="<%=fileList.get(0)%>" /> <% }%>
				<% if(fileList != null && size>=2){ %> 
				<input type="hidden" name="prdList" value="<%=fileList.get(1)%>" /> <% }%>
				<% if(fileList != null && size>=3){ %> 
				<input type="hidden" name="prdCheck" value="<%=fileList.get(2)%>" /> <% }%>
				<% if(fileList != null && size>=4){ %> 
				<input type="hidden" name="prdOrder" value="<%=fileList.get(3)%>" /> <% }%>
          </div>
  </form>        
          		<form action="/vancl/manage/upload" id="uploadForm" enctype="multipart/form-data" method="post">
          <div class="line_pubForm">
            <p>产品缩略图：
				<input class="default" type="file" id="file1" name="file1" /> <% if(fileList != null && size>=1){ %> <label ><% out.print(fileList.get(0));%></label>
				<input type="hidden" name="prdColor" value="<%=fileList.get(0)%>" /> <% }%>
				<br />常规展示图：
				<input class="default" type="file" id="file2" name="file2" /> <% if(fileList != null && size>=2){ %> <label ><% out.print(fileList.get(1));%></label>
				<input type="hidden" name="prdList" value="<%=fileList.get(1)%>" /> <% }%>
				<br />放大展示图：
				<input class="default" type="file" id="file3" name="file3" /> <% if(fileList != null && size>=3){ %> <label ><% out.print(fileList.get(2));%></label>
				<input type="hidden" name="prdCheck" value="<%=fileList.get(2)%>" /> <% }%>
				<br />放大概览图：
				<input class="default" type="file" id="file4" name="file4" /> <% if(fileList != null && size>=4){ %> <label ><% out.print(fileList.get(3));%></label>
				<input type="hidden" name="prdOrder" value="<%=fileList.get(3)%>" /> <% }%>
				<br />
				<input type="button" value="开始上传" id="uploadbutton" onclick="gotoUpload()" />

				<br />
			<div id="progressBar" style="display: none;">

				<div id="theMeter">
					<div id="progressBarText"></div>

					<div id="progressBarBox">
						<div id="progressBarBoxContent"></div>
					</div>
				</div>
			</div>
            
      <input type="hidden" id="cid" name="cid"  />   
      <input type="hidden" id="cname" name="cname"  /> 
      <input type="hidden" id="gid" name="gid"  />  
      <input type="hidden" id="target" name="target"  />  
            
          </div>
</form>

<div class="line_pubForm">
	<input type="button" value="保存" id="commit" onclick="saveSubInfo()" /> <input type="button" value="返回"  onclick="returnBack()" />
</div>

  </div>

</body>

<script language="javascript">
	function saveSubInfo(){
		var subForm = document.getElementById("savePicInfo");
		//alert(subForm);
		subForm.submit();
	}
	
	function returnBack(){
		location.href = "manageSubColor.do?good_id=<%=goodId%>&color_id=<%=colorId%>";
	}
	function gotoUpload(){
		var subForm = document.getElementById("uploadForm");
		
		$('cid').value = $('colorId').value;
		$('cname').value = $('colorName').value;
		$('gid').value = $('goodId').value;
		$('target').value = 'addSuitPic';
		var iAction = subForm.action + "?cid="+ $('cid').value + "&cname=" + $('cname').value + "&gid=" + $('gid').value + "&target="+$('target').value;
		subForm.action = iAction;
		startProgress();
	//	alert(subForm);
		subForm.submit();	
	}
	</script>
	
	
</html>
